Skip to content

ci: publish an honest automated review status - #3991

Merged
kwakayama merged 4 commits into
mainfrom
fix/issue-724-automated-review-gate
Aug 22, 2026
Merged

kwakayama merged 4 commits into
mainfrom
fix/issue-724-automated-review-gate

Conversation

@kojiwakayama

@kojiwakayama kojiwakayama commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Summary

  • publish a dedicated Automated review commit status on the exact pull request head
  • fail the status when neither CodeRabbit nor Codex submitted a real review for that commit
  • accept authenticated CodeRabbit no-finding summaries only when they include the current full SHA
  • hold draft pull requests at pending, so "not reviewed yet" never renders as a pass and never as a missing status
  • rerun on pull request updates, submitted and dismissed reviews, and bot issue-comment updates
  • execute only trusted default-branch code under pull_request_target authority

The states

Situation Status
CodeRabbit or Codex submitted a review for the head SHA success
CodeRabbit no-actionable summary naming the head SHA success
Rate limited, skipped, or reviewed only an older SHA failure
Review dismissed failure, recomputed on the dismissed event
GitHub API error or timeout while listing reviews failure
Draft pull request pending

"No findings" and "did not run" never render the same, and the lookup fails closed: a throw inside the review lookup still publishes failure, it does not skip the status.

Red and green

The workflow contract test initially failed because no review gate existed. Live reproduction confirmed the false-green condition: CodeRabbit can report success while posting only a rate-limit comment and no review.

The classifier was verified against live API payloads:

Fork pull requests

GitHub gives pull_request_review a read-only GITHUB_TOKEN for pull requests from forks, so createCommitStatus would return 403 there. The job skips that trigger when the head repo is not this repo. Fork pull requests still get their status from pull_request_target and issue_comment, which both keep write authority, so the fork path stays fail-closed rather than crashing.

Verification

  • deno task typecheck
  • deno task lint:ci
  • deno task fmt:check
  • deno task test:file scripts/ci/automated-review-gate.test.ts
  • node --check scripts/ci/automated-review-gate.mjs
  • mutating the decision to always report success turns the test suite red

After merge, repository rules can require the Automated review status context if enforcement at merge time is desired. Even without that rule, skipped reviews are no longer indistinguishable from green reviews in the pull request status surface.

Refs veryfront/veryfront-issue-inbox#724

@coderabbitai

coderabbitai Bot commented Aug 22, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@kwakayama, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 22 minutes

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

Wait for the limit to reset, then comment @coderabbitai review or push new commits to the PR.

An organization admin can change what happens after included review limits in Billing.

How do review limits work?

CodeRabbit enforces per-developer PR review limits within each organization.

For paid Pro and Pro+ reviews, CodeRabbit uses a developer's included PR review attempts over the past 7 days to set the current hourly allowance. At typical activity levels, the full plan allowance applies. Higher sustained activity can lower the allowance until earlier attempts leave the 7-day window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ef4833ce-dde0-4092-903c-57e5db85a328

📥 Commits

Reviewing files that changed from the base of the PR and between 8f530af and ba96bdf.

📒 Files selected for processing (4)
  • .github/workflows/automated-review-gate.yml
  • deno.json
  • scripts/ci/automated-review-gate.mjs
  • scripts/ci/automated-review-gate.test.ts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown

📦 Client bundle boundary

Entrypoint Modules Source size Server leaks
src/index.client.ts 327 1961 KiB ✅ 0

A server module in a client graph aborts hydration in the browser. New leaks fail CI; known leaks are tracked in scripts/lint/client-bundle-baseline.json to burn down.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d748d92f81

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/automated-review-gate.yml Outdated
Comment thread .github/workflows/automated-review-gate.yml Outdated
Resolve the deno.json test:scripts conflict by keeping the main branch entry
and re-adding scripts/ci/automated-review-gate.test.ts to the script suite.
Read the gate from the default branch instead of the pull request base
commit. Every pull request opened before this gate lands has a base commit
that predates scripts/ci/automated-review-gate.mjs, so the checkout produced
ERR_MODULE_NOT_FOUND and the job crashed before publishing any status. A
crash publishes nothing, which is the same false green the gate exists to
remove. The default branch is equally trusted under pull_request_target and
always carries the current gate.

Publish a pending status for draft pull requests instead of returning early.
Review bots skip drafts, so a draft has no verdict yet. Returning early left
no "Automated review" context at all, which is indistinguishable from a
workflow that never ran. Pending says "not decided yet" and can never read
as a pass.

Rerun the gate when a review is dismissed. The classifier rejects DISMISSED
reviews, so dismissing a qualifying bot review used to leave a stale success
status in place until the next push.

Skip the pull_request_review trigger on fork pull requests. GitHub gives
that event a read-only GITHUB_TOKEN for pull requests from forks, so
createCommitStatus returns 403 and the run dies without updating anything.
The trusted pull_request_target and issue_comment runs still publish the
decision, so the fork case stays fail-closed rather than crashing.

Add tests for the fail-closed transport-error path and the draft pending
path, and pin the workflow contract to the new checkout ref, the dismissed
trigger, the fork guard, and the draft flag.
The gate is imported from the default branch checkout. If that file is
missing or broken, the dynamic import threw and the job died before
publishing anything, so the pull request showed no `Automated review`
context at all. No context looks the same as a skipped review, which is the
exact confusion this workflow exists to remove.

Catch the import failure, publish `failure` with a description that names
the cause, and mark the job failed. The workflow contract test asserts the
fallback, so removing it turns the suite red.
@kwakayama
kwakayama added this pull request to the merge queue Aug 22, 2026
Merged via the queue into main with commit 34d53d0 Aug 22, 2026
40 checks passed
@kwakayama
kwakayama deleted the fix/issue-724-automated-review-gate branch August 22, 2026 22:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants